package com.content.view.Component.Button
{
	import com.library.core.IDisposable;
	import com.library.core.UIObject;
	
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	
	public class ImageButton2Obj extends UIObject implements IDisposable
	{
		public var id:String;
		private var _obj:DisplayObject;
		private var _objActive:DisplayObject;
		
		public function ImageButton2Obj(obj:DisplayObject, objActive:DisplayObject)
		{
			super();
			
			this.mouseChildren = false;
			this.buttonMode = true;
			
			_obj = obj;
			_objActive= objActive;
			addChild(_obj);
			addChild(_objActive);
			
			this.addEventListener(MouseEvent.MOUSE_OVER, OnOver);
			this.addEventListener(MouseEvent.MOUSE_OUT, OnOut);
		}
		
		/* Event Handler
		* -------------------------------------------------------------*/
		protected function OnOver(evt:MouseEvent):void{
			_obj.visible = false;
			_objActive.visible = true;
		}
		protected function OnOut(evt:MouseEvent):void{
			_obj.visible = true;
			_objActive.visible = false;
		}
		
		public function Dispose():void
		{
			this.removeEventListener(MouseEvent.MOUSE_OVER, OnOver);
			this.removeEventListener(MouseEvent.MOUSE_OUT, OnOut);
		}
	}
}